computerprojectsdufffandomcom-20200215-history
HTTP
What is HTTP? HTTP stands for Hypertext Transfer Protocol. The definition of a protocol in this case is a standard procedure for defining and regulating communications. The foundation of the Internet is HTTP, it is it’s main protocol for data communication because it is the most popular application used on the Web. To understand how it is used first you need to know that the Internet is a distributed client/server information system. Communication is necessary between the client and the server, HTTP makes that communication possible. With HTTP all kinds of data is transferred between the server and the client, it can be text, images like photos and videos or even audio like music. You have probably also heard of HTTPS, this is when HTTP is layered with a security protocol such as SSL. This adds all of the SSL security capabilities to HTTP communications. For any communication between a client and a server the message is encrypted. This protects the communication from being viewed, read or redirected. In the beginning HTTPS was used mostly for any type of payment transaction on the Internet and Email. Now HTTPS is widely used to protect websites, user communications and for keeping your web browsing private. How does HTTP Work? First, an HTTP client sends a request message to an HTTP server. A client can be a smart phone, a laptop or desktop computer. Next a Web server returns with a response message. The client is pulling the information from the server, which is why HTTP is called a pull protocol. Both the request message and the response message are formatted in a specific way. In the HTTP request message the first line is called the request line which is then followed by header lines. There are three fields stored in the request line: # Method field # URL field # HTTP Version field Typically the request messages use the GET method, the browser is requesting an object and that object is identified in the URL field. There are other values that can be used in the method field such as POST, HEAD, PUT and DELETE. This is an example of a HTTP request showing the request line and the following header lines taken from the website https://www.3.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html showing the request line and the following header lines. The URL http://www.test101.com/doc/index.html would be translated into this request message: GET/docs/index.html HTTP/1.1 Host: www.test101.com Accept: image/gif, image/jpeg, */* Accept-Language: en-us Accetp-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) (blank line) The response message that will be sent back to the client by the server has three sections: # Status line # Header Lines # Entity Body The requested object from above is stored in the entity body. Have you ever seen this message before? 404 Not Found: The requested document does not exist on this server. That’s the status line, which consists of the status code and a corresponding message. This is an example of a HTTP response message to the request from above taken from the website https://www3.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html showing the three sections. HTTP/1.1 200 OK Date: Sun, 18 Oct 2009 08:56:53 GMT Server: Apache/2.2.14 (Win32) Last-Modified: Sat, 20 Nov 2004 07:16:26 GMT ETag: “1000000565a5-2c-3e94b66c2e680” Accept-Ranges: bytes Content-Length: 44 Connection: close Content-Type: text/html X-Pad: avoid browser bug It works! Who uses HTTP? Programmers who understand HTTP are able to write Web browser, Web servers, automatic page downloaders and more. Everyone on the internet uses HTTP. Whenever the web browser displays a web page, picture, etc. from a web server it does it using HTTP. For a user on the internet it is easy to use because it is behind the scenes but for a programmer it is a complex language. On a scale of one to ten understanding HTTP is an 8 while using it is a 1. References http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol https://www3.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html http://www.jmarshall.com/easy/http/ Questions 1. The three fields stored in the request line are: a. GET, DATE, TIME b. Method, URL, HTTP Version c. Status, Body, Method d. URL, Entity Body, GET 2. Which statement is true? a. HTTP is considered a pull protocol b. HTTP requests information from the client and sends it to the server c. HTTP is the least used protocol on the Web d. HTTP stands for Hyperactivity Transferring Program 3.The internet is a . . . a. Token ring network b. Local Area network c. Distributed Client/Server Information system d. Great place to waste a lot of time 4.HTTP is the main protocol for: a. System audio b. Key logging c. Animation and graphics d. Data and communication 5. Which of these statements is an example of an Status Code and message: a. 404 Not Found: The requested document does not exist on this server b. 911: Please state your emergency c. 411: The person you are trying to reach is currently unavailable d. 015: Please stand by for the satellite signal 6. How many sections are there in a response message from the Server? a. 5 b. 3 c. 12 d. 9 7.A client can be a . . . a. Laptop b. Desktop c. Cell phone d. All of the above 8. What protocol do you layer HTTP with to get HTTPS? a. SSL b. DOS c. Macintosh d. IOS 9.HTTPS was used in the beginning for: a. To protect downloads from viruses b. To protect payment transactions c. To protect email messages d. A and B e. B and C f. All of the above 10. What method do request message typically use? a. GET b. DELETE c. POST d. PUT